using System;

namespace LocalOverride.Fiddler.Store
{
    public class UrlRequiredValidator : IValidator
    {
        private readonly MappingEntry mappingEntry;

        public UrlRequiredValidator(MappingEntry mappingEntry)
        {
            this.mappingEntry = mappingEntry;
        }

        public ValidationResult Validate()
        {
            var error = new ErrorNotification("Url", "Url is required");
            if(String.IsNullOrEmpty(mappingEntry.Url))
            {
               return new ValidationResult(false, error);
            }
            else
            {
                return ValidationResult.Valid;
            }
        }
    }
}